package com.museum.data;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import org.xmlrpc.android.XMLRPCClient;
import org.xmlrpc.android.XMLRPCException;

import android.util.Log;

public class XmlRpc {
	private XMLRPCClient client;
	private URI uri;
	@SuppressWarnings("unchecked")
	public Map<String, Object> call(String method, HashMap<String, String> params){
		String xmlRpcUrl = "http://we.in.th/xmlrpc.php";
    	//String xmlRpcUrl = "http://phpxmlrpc.sourceforge.net/server.php";
    	uri = URI.create(xmlRpcUrl);
		client = new XMLRPCClient(uri);
      	
      	Map<String, Object> response = null;
      	try {
      		response = (Map<String, Object>)client.call(method, params);
      	} catch (XMLRPCException e) {
      		Log.d("Error ", "Error: "+ e.getMessage());
      	}
      	return response;
	}
}
